data(nyc_airbnb)

nyc_airbnb = 
  nyc_airbnb %>% 
  mutate(rating = review_scores_location / 2) %>%
  select(
    neighbourhood_group, neighbourhood, rating, price, room_type, lat, long) %>%
  filter(
    !is.na(rating), 
    neighbourhood_group == "Manhattan",
    room_type == "Entire home/apt",
    price %in% 100:500)
nyc_airbnb %>% 
  mutate(text_label = str_c("Price: $", price, "\nRating: ", rating)) %>% 
  plot_ly(
    x = ~lat, y = ~long, color = ~price, text = ~text_label, 
    alpha = .5, type = "scatter", mode = "markers")
## Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.
nyc_airbnb %>% 
  mutate(neighbourhood = fct_reorder(neighbourhood, price)) %>% 
  plot_ly(
    y = ~price, x = ~neighbourhood, color = ~neighbourhood,
    type = "box", colors = "viridis")
nyc_airbnb %>% 
  count(neighbourhood) %>% 
  mutate(neighbourhood = fct_reorder(neighbourhood, n)) %>% 
  plot_ly(
    x = ~neighbourhood, y = ~n, color = ~neighbourhood, 
    type = "bar", colors = "viridis")